package com.example.tiptravel.presenter.home;

import com.example.tiptravel.entity.home.spot.SpotEntity;
import com.example.tiptravel.model.ModelFactory;
import com.example.tiptravel.view.impl.home.SpotView;

import java.util.Map;

import rx.Subscriber;

/**
 * Created by 45820 on 2016/11/10.
 */

public class SpotPresenter {

    private SpotView spotView;

    public SpotPresenter(SpotView spotView) {
        this.spotView = spotView;
    }

    public void getSpotData(Map<String, String> map) {
        ModelFactory.getiHomeModel().getSpotData(map, new Subscriber<SpotEntity>() {
            @Override
            public void onCompleted() {
                spotView.onComplete();
            }

            @Override
            public void onError(Throwable e) {
                spotView.onFailure(e);
            }

            @Override
            public void onNext(SpotEntity spotEntity) {
                spotView.onSuccess(spotEntity);
            }
        });
    }
}
